package kr.hkit.androidcomplete03.ch22;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class Scale extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new MyView(this));
	}

	protected class MyView extends View {
		// 생성자 생성
		public MyView(Context context) {
			super(context);
		}

		// 그리기 함수
		public void onDraw(Canvas canvas) {
			Paint Pnt = new Paint();
			Pnt.setAntiAlias(true);

			Pnt.setColor(Color.YELLOW);
			canvas.drawRect(50, 50, 150, 150, Pnt);

			Pnt.setColor(Color.GREEN);
			canvas.save();
			canvas.scale(1.5f, 1.5f);
			canvas.drawRect(50, 50, 150, 150, Pnt);

			Pnt.setColor(Color.BLUE);
			canvas.restore();
			canvas.save();
			canvas.scale(0.5f, 0.5f);
			canvas.drawRect(50, 50, 150, 150, Pnt);

			Pnt.setColor(Color.RED);
			canvas.restore();
			canvas.scale(0.5f, 0.5f, 100, 100);
			canvas.drawRect(50, 50, 150, 150, Pnt);

		}

	}
}
